//
// Created by zhuyijun on 2021/8/23.
//

#include <iostream>
#include "tabtenn.h"

using namespace std;

int main() {
    TableTennisPlayer player1("Tara", "Boomdea", false);
    RatedPlayer rPlayer1(1140, "Mallory", "Duck", true);
    rPlayer1.Name();
    if (rPlayer1.HashTable())
        cout << ": hash a table." << endl;
    else
        cout << ": hasn't a table." << endl;
    player1.Name();
    if (player1.HashTable())
        cout << ": hash a table." << endl;
    else
        cout << ": hasn't a table." << endl;
    cout << "Name: ";
    rPlayer1.Name();
    cout << "; Rating: " << rPlayer1.Rating() << endl;

    RatedPlayer rplayer2(1212, player1);
    cout << "Name: ";
    rplayer2.Name();
    cout << "; Rating: " << rplayer2.Rating() << endl;

    //可以将子类对象地址赋值给父类引用（其使用隐式重载运算符等于）
    TableTennisPlayer *rp = &rplayer2;
    rp->Name();
    return 0;
}

